//package com.service.impl;
//import com.pojo.Floor;
//import com.mapper.FloorMapper;
//import com.service.FloorService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import java.util.List;
//
//@Service
//public class FloorServiceImpl implements FloorService {
//    @Autowired
//    private FloorMapper floorMapper;
//
//    // ---------------------- 基础操作 ----------------------
//    @Override
//    public void add(Floor floor) {
//        floorMapper.insert(floor);
//    }
//
//    @Override
//    public List<Floor> listByBuilding(Integer buildingId) {
//        return floorMapper.selectByBuildingId(buildingId);
//    }
//
//    // ---------------------- 更新与删除 ----------------------
//    @Transactional
//    @Override
//    public void updateModelPath(Integer id, String modelPath) {
//        Floor floor = floorMapper.selectById(id);
//        if (floor == null) {
//            throw new RuntimeException("楼层不存在");
//        }
//        floor.setModelPath(modelPath);
//        floorMapper.updateById(floor);
//    }
//
//    @Transactional
//    @Override
//    public void delete(Integer id) {
//        if (floorMapper.selectById(id) == null) {
//            throw new RuntimeException("楼层不存在");
//        }
//        floorMapper.deleteById(id);
//    }
//}
